using System.Data.Entity.ModelConfiguration;

namespace CrawlerFramework.Models.Mapping
{
    public class ScheduledJobMap : EntityTypeConfiguration<ScheduledJob>
    {
        public ScheduledJobMap()
        {
            // Primary Key
            HasKey(t => t.ScheduledJobId);

            // Properties
            Property(t => t.JobGuid)
                .IsRequired();

            Property(t => t.LinkConfigGuid).IsRequired();

            // Table & Column Mappings
            ToTable("ScheduledJob");
            Property(t => t.ScheduledJobId).HasColumnName("ScheduledJobId");
            Property(t => t.JobGuid).HasColumnName("JobGuid");
            Property(t => t.CrawlStatus).HasColumnName("CrawlStatus");
            Property(t => t.JobDescription).HasColumnName("JobDescription");
            Property(t => t.LinkConfigGuid).HasColumnName("LinkConfigGuid");
            Property(t => t.Hours).HasColumnName("Hours");
            //Property(t => t.IsDelete).HasColumnName("IsDelete");
            Property(t => t.IsEnabled).HasColumnName("IsEnabled");
            Property(t => t.LastStart).HasColumnName("LastStart");
            Property(t => t.LastEnd).HasColumnName("LastEnd");
            Property(t => t.LastSuccess).HasColumnName("LastSuccess");
            Property(t => t.RunAfterJobGuid).HasColumnName("RunAfterJobGuid");
            Property(t => t.LinkId).HasColumnName("LinkId");
        }
    }
}
